<script setup>
import { useVModel } from '@vueuse/core'
const props = defineProps({
  value: {
    type: String,
    default: ''
  },
  nowTime: {
    type: Number,
    default: new Date().getTime()
  }
})
const emit = defineEmits(['update:value'])
const modelValue = useVModel(props, 'value', emit)

const inputValue = computed({
  get() {
    return modelValue.value.split('_')[0]
  },
  set(val) {
    modelValue.value = val.split('_')[0] + '_' + props.nowTime
  }
})
</script>

<template>
  <a-input class="flex-auto" v-model:value="inputValue">
    <template #addonAfter>
      <div>_{{ nowTime }}</div>
    </template>
  </a-input>
</template>

<style scoped lang="less"></style>
